/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.training.utils;


public enum BusinessCode {
    SUCCESS(0,"success"),
    FAILURE(-1,"fail"),
    EXCEPTION(-2,"执行过程中发生异常"),
    NOT_LONGIN(10000,"没有登录，无法执行操作"),
    FILE_EMPTY(-4,"文件为空"),
    NOT_CHANGE_DATA(1200000,"未选中数据"),
    ILLEGAL_PARAM(1200001,"不合法的参数"),
    TRAINING_EMPTY_TYPE(1200002,"培训类型不能为空"),
    COURSE_EMPTY_NAME(1200003,"培训课程名称不能为空"),
    COURSE_EMPTY_NUMBER(1200004,"培训课程编号不能为空"),
    TRAINING_EMPTY_DURATION(1200005,"培训时长不能为空"),
    TRAINING_EMPTY_EXAMINATIONURL(1200006,"培训考试网址不能为空"),
    COURSENAME_NOT_EXIST(1200007,"培训课程不存在"),
    TRAINING_EMPTY_MANAGER(1200008,"培训负责人不能为空"),
    TRAINING_EMPTY_COMPANY(1200009,"培训单位不能为空"),
    TRAINING_EMPTY_PLANNAME(1200010,"培训计划名称不能为空"),
    TRAINING_EMPTY_STARTTIME(1200011,"开始时间不能为空"),
    TRAINING_EMPTY_ENDTIME(1200012,"结束时间不能为空"),
    TRAINING_EMPTY_COURSEWARE(1200013,"培训课件不能为空"),
    PLANNAME_NOT_EXIST(1200014,"培训计划不存在"),
    COURSENAME_EMPTY_CORPCODE(1200015,"培训课程所属水司不能为空"),
    TRAINING_EMPTY_STAFF(1200016,"培训人员不能为空"),
    TRAINING_EMPTY_DEPT(1200017,"人员所属部门不能为空"),
    MESSAGE_DESCRIPTION_EXCEPTION(1200018,"数据库连接异常"),
    TRAININGPLAN_NOT_EXIST(1200019,"培训计划不存在"),
    TRANING_NOT_EXIST(1200020,"培训记录不存在，无法操作"),
    TRAINING_EMPTY_LEVEL(1200021,"培训级别不能为空"),
    PARAM_NOT_EMPTY(1200022,"必要参数不能为空"),
    TRAINING_EMPTY_NAME(1200023,"培训名称不能为空"),
    TRAINING_EMPTY_UNIT(1200024,"培训单位不能为空"),
    ;
    private final int code;
    private final String description;

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    BusinessCode(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static BusinessCode valueOf(int value){
        switch (value){
            case 0:
                return SUCCESS;
            case -1:
                return FAILURE;
            case -2:
                return EXCEPTION;
            case -3:
                return NOT_LONGIN;
            case 1200000:
                return NOT_CHANGE_DATA;
            case 1200001:
                return ILLEGAL_PARAM;
            default:
                return null;
        }
    }
}
